package com.java.demo.controller;

import com.java.demo.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.annotation.PostConstruct;

//@Controller
public class UserController {
    @Autowired
    private User user;

    public void printUser() {
        System.out.println(user);
        // 修改User
        User myUser = user;
        myUser.setName("悟空");
        System.out.println("myUser -> " + myUser);
        System.out.println("user -> " + user);
    }

    @PostConstruct
    public void doPostConstruct() {
        System.out.println("初始化");
        System.out.println(user.toString());
    }
}
